import './search.scss';

import Mask from './Mask';

const Search = React.createClass({
     getInitialState(){
        return{
            showModal:false
        }
     },
    componentWillReceiveProps(newPorps){
        setTimeout(function(){
            this.setState({ showModal:newPorps.show });
        }.bind(this),100)
    },
     render(){
         return(
           <Mask show={this.props.show} opacity={0}>
               <div className={ this.state.showModal ? "search_modal show" : "search_modal" }>
                    <div className="search_box">
                        <div className="back" onClick={this.close}></div>
                        <div className="search_input">
                            <input type="text" />
                            <div className="search_enter"></div>
                        </div>
                    </div>
               </div>
           </Mask>
         )
     },
    close(){
       this.props.close ? this.props.close() : "" ;
    }
});



module.exports = Search;